package com.PuzGame.combinenumbers;

import java.util.ArrayList;
import java.util.List;

import com.PuzGame.combinenumbers.Interfaces.GeneralSettingsObserver;

public class GeneralSettings 
{
	private boolean SFX;
	private boolean Vibration;
	private boolean QuickPlayMode;
	private boolean KeepAwake;
	
	private List<GeneralSettingsObserver> observers = new ArrayList<GeneralSettingsObserver>();
	
	
	
	public boolean isSFX() {
		return SFX;
	}

	public void setSFX(boolean sFX) {
		if(SFX == sFX)
			return;
		SFX = sFX;
		notifyAllObserversThatSFXChanged();
	}

	private void notifyAllObserversThatSFXChanged() {
		for (GeneralSettingsObserver observer : observers) {
	         observer.onSFXChanged();
	      }
		
	}

	public boolean isVibration() {
		return Vibration;
	}

	public void setVibration(boolean vibration) {
		if(Vibration == vibration)
			return;
		Vibration = vibration;
		notifyAllObserversThatVibrationChanged();
	}

	private void notifyAllObserversThatVibrationChanged() {
		for (GeneralSettingsObserver observer : observers) {
	         observer.onVibrationChanged();
	      }
		
	}

	public boolean isQuickPlayMode() {
		return QuickPlayMode;
	}

	public void setQuickPlayMode(boolean quickPlayMode) {
		if(QuickPlayMode == quickPlayMode)
			return;
		QuickPlayMode = quickPlayMode;
		notifyAllObserversThatQuickPlayModeChanged();
	}

	private void notifyAllObserversThatQuickPlayModeChanged() {
		for (GeneralSettingsObserver observer : observers) {
	         observer.onQuickPlayModeChanged();
	      }
		
	}

	public boolean isKeepAwake() {
		return KeepAwake;
	}

	public void setKeepAwake(boolean keepAwake) {
		if(KeepAwake == keepAwake)
			return;
		KeepAwake = keepAwake;
		notifyAllObserversThatKeepAwakeChanged();
	}

	private void notifyAllObserversThatKeepAwakeChanged() {
		for (GeneralSettingsObserver observer : observers) {
	         observer.onKeepAwakeChanged();
	      }
		
	}
	
	public void attach(GeneralSettingsObserver observer){
	      observers.add(observer);		
	   }

	
	
	
	
}